<STYLE>
body,html{background:none !important;}
.deal_coupon{padding:20px;}
.site_logo{border-bottom:1px dotted #ccc; padding-bottom:10px; margin-bottom:10px;}
.site_logo img {
    width: 250px;
}
.deal_title {
    font-size: 20px;
}
.coupon_info {
    border-top-color: #ddd;
    border-top-style: solid;
    border-top-width: 1px;
    font-size: 15px;
    line-height: 30px;
    padding-top: 10px;
}
.listing_info{ border-top-color: #ddd;
    border-top-style: solid;
    border-top-width: 1px;
    font-size: 13px;
    line-height: 20px;
    padding-top: 10px;}
.listing_info p{padding:10px 0px;}
.size1of2{width:47%;margin-right:20px;}
  .coupon_steps li{  list-style-type: decimal;
float:left; font-size:13px;font-weight:bold;margin-right: 35px;color:#2052A2;
}
.button{font-size:16px  !important;padding:3px 35px !important;}
.button_wrap {
    margin-bottom: 0;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0;
    width: 100px;
}
#header{display: none;}
#content {
    padding: 0;
}
</STYLE><?php
$dealUrl = cr("cmsConfig.Backend.siteUrl").$dealOrder['Deal']['viewUrl'];
$dealImage = cr("cmsConfig.Backend.siteUrl").$dealOrder['Deal']['image'];
?>
<div class="deal_coupon">
	<span class="fr" stype="padding-right:40px;">
		<?php echo $html->link(__("Close"),'javascript:void(0)',array("onclick"=>"closeMe();",'class'=>'close_link'));?>
	</span>
	<div class="site_logo">
		<?php echo $this->element("site_logo"); ?>
	</div>
	<div class="clear"></div>
	<div class="deal_box line">
		<div class="unit size1of4">
			<div class="image">
				<?php 
				$img = $html->image($dealImage, array('alt'=>$dealOrder['Deal']['title'],'thumb'=>array('crop'=>false, 'height'=>cr('Thumbs.listingSmall.height'), 'width'=>cr('Thumbs.listingSmall.width')), 'height'=>cr('Thumbs.listingSmall.height'), 'width'=>cr('Thumbs.listingSmall.width')));
				echo $html->link($img,$dealUrl,array('escape'=>false)); 
				?>
			</div>
		</div>
		<div class="unit size3of4">
			<div class="deal_title">
				<?php echo $html->link($dealOrder['Deal']['title'],$dealUrl,array('escape'=>false)); ?>
			</div>
		</div>
	</div>
	<div class="clear"></div>
	<br>
	<div class="coupon_info">
			<div class="line">
				<div class="unit size1of2">
					<strong><?php echo __("Deal code"); ?></strong>:
					<?php
					if(!$dealOrderCode)
					{ 
						$dealOrderCode = Set::extract($dealOrder,"{n}.DealOrderCode.deal_code");
						$dealOrderCode = implode(", ", $dealOrderCode);
					}
					echo $dealOrderCode;
					?>
				</div>
				<div class="unit size1of2">	
					<strong><?php echo __("Deal ID"); ?></strong>: 
					<?php echo $dealOrder["Deal"]["id"]; ?>
				</div>
			</div>
			<div class="clear"></div>
			<div class="line">
				<div class="unit size1of2">	
					<strong><?php echo __("Order ID"); ?></strong>: 
					<?php echo $dealOrder["DealOrder"]["id"]; ?>
				</div>
				<div class="unit size1of2">
					<strong><?php echo __("Validity"); ?></strong>: 
					<?php echo date("Y-m-d", strtotime($dealOrder["DealOrder"]["created"])).__(" to ").date("Y-m-d", strtotime($dealOrder["Deal"]["expires"])); ?>
				</div>
			</div>
	</div>
	<div class="clear"></div>
	<br>
	<div class="listing_info line">
		<div class="unit size1of1">
			<strong><?php echo __("Vendor");?></strong>: 
			<?php echo $html->link($listing['Listing']['title'],cr("cmsConfig.Backend.siteUrl").$listing['Listing']['viewUrl'],array('escape'=>false)); ?>
			<br>
			<?php foreach ($listingAddress as $addressLine) { ?>
				<span>
				<?php echo $addressLine; ?>
				</span>
				<br>
			<?php } ?>
		</div>
	</div>
	<div class="clear"></div>
	<br>
	<div class="listing_info line">
		<div class="unit size1of2">
			<strong><?php echo __("Fine print");?></strong>: 
			<?php echo $dealOrder['Deal']['fine_print']; ?>
		</div>
		<div class="unit size1of2">
			<strong><?php echo __("Terms");?></strong>: 
			<?php echo $dealOrder['Deal']['terms']; ?>
		</div>
	</div>
	<div class="clear"></div>
	<br>
	<hr>
	<div>
		<strong><?php echo __("How to use this coupon");?></strong>:
	</div>
	<div class="coupon_steps">
		<ul>
			<li class="step1">
				<?php echo __("Print this coupon");?> 
			</li>
			<li class="step2">
				<?php echo __("Present it in the listing and the indicated place");?>
			</li>
			<li class="step3 last">
				<?php echo __("Ready");?>
			</li>
		</ul>
	</div>
	<div class="clear"></div>
	<br><br>
	<div align="center" class="button_wrap">
		<strong>
			<a href="#" class="print button" onclick="printMe()"><?php echo __("Print")?></a>
		</strong>
	</div>
</div>
<script>
	function printMe()
	{
		$('.print').hide();
		$('.close_link').hide();
		window.print();
		$('.print').show();
		$('.close_link').show();
	}
	function closeMe()
	{
		self.close();
	}
	
	$(document).ready(function(){
		<?php if(isset($this->params['named']['print'])) { ?>
			printMe();
		<?php } ?>
		$("#footer").hide();
	})
</script>
